<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    function createCounter() {
        let count = 0;
        function increment() {
            count++;
            console.log(count);
        }
        return increment;
    }
    const incrementCounter = createCounter(); // 创建一个闭包
    incrementCounter(); // 输出 1
    incrementCounter(); // 输出 2
    incrementCounter(); // 输出
</script>
</body>
</html>